<%-- 
    Document   : list-poduct
    Created on : Aug 22, 2011, 8:40:11 PM
    Author     : NhatHuy
--%>

<%@page import="pojo.GiayPOJO"%>
<%@page import="dao.GiayDAO"%>
<%@page import="dao.LoaiGiayDAO"%>
<%@page import="pojo.LoaiGiayPOJO"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
    //Lấy giới tính.
    int gioiTinh = 0;
    if (request.getParameter("GioiTinh") != null){
        gioiTinh = Integer.parseInt(request.getParameter("GioiTinh"));
    }
    
    //Lấy tham số mã loại giày.
    int maLoaiGiay = 0;
    if (request.getParameter("MaLoaiGiay") != null){
        maLoaiGiay = Integer.parseInt(request.getParameter("MaLoaiGiay"));
    }
    //Lấy số trang.
    int trang = 1;
    if (request.getParameter("Trang") != null) {
        trang = Integer.parseInt(request.getParameter("Trang"));
    }
    //out.println("Mã loại giày là: "+maLoaiGiay);
    //Lấy danh sách giày theo mã loại giày - thuộc theo trang.
     ArrayList<GiayPOJO> dsGiay = GiayDAO.layDanhMucGiay_TheoGioiTinh_TheoLoaiGiay_Client_PhanTrang(gioiTinh, maLoaiGiay, trang);
     
%>

<div id="list-poduct"><!--Start list-poduct-->
    <% for (int i=0; i<dsGiay.size(); i++){ 
        GiayPOJO giay = dsGiay.get(i);
    %>
        <div id="poduct" onMouseOver="show_submit('v<%=(i+1)%>')" onMouseOut="hide_submit('v<%=(i+1)%>')"><!--Start poduct-->
            <a rel="prettyPhoto" href="<%=request.getContextPath()%>/client/<%=giay.getHinhAnh()%>">
            <form method="post" action=""><input type="submit" name="subview" value="ảnh lớn" style="visibility: hidden; position: relative;" id="v<%=(i+1)%>" class="button"> 
            </form></a><a href="<%=request.getContextPath()%>/ChiTietGiayController?Action=View&GioiTinh=<%=gioiTinh%>&MaLoaiGiay=<%=maLoaiGiay%>&MaGiay=<%=giay.getMaGiay()%>"><img src="<%=request.getContextPath()%>/client/<%=giay.getHinhAnh()%>"> </a>
            <div id="text1">
                <a href="<%=request.getContextPath()%>/ChiTietGiayController?Action=View&GioiTinh=<%=gioiTinh%>&MaLoaiGiay=<%=maLoaiGiay%>&MaGiay=<%=giay.getMaGiay()%>"><%=giay.getTenGiay()%></a> 
            <%
                if (giay.getMaTinhTrang() == 1){%>
                    <IMG src="<%=request.getContextPath()%>/client/images/new.jpg">
                <%}%>
            </div>
            <div id="text2"><%= giay.getGiaBan()%> </div>
            <div id="text3"></div>
            <%
                if (session.getAttribute("KhachHang") != null){
            %>
                <a href="<%=request.getContextPath()%>/GioHangController?action=Them&MaGiay=<%=giay.getMaGiay()%>">
                    <img src="<%=request.getContextPath()%>/client/images/btThemVaoGio.png" class="btThemVaoGio" />
                </a>
            <% }%>
        </div><!--End poduct-->
    <%}%>
    <div class="clear"></div>
</div><!--End list-poduct-->
